-
Notifications
You must be signed in to change notification settings - Fork 49
Add SynchronousNonBlockingStepExecution.ExecutorServiceAugmentor
extension point
#226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add SynchronousNonBlockingStepExecution.ExecutorServiceAugmentor
extension point
#226
Conversation
I am not sure I follow the use case, and there is no downstream PR. My general recommendation for any code creating an try { // TODO Java 21+
return (ExecutorService) Executors.class.getMethod("newVirtualThreadPerTaskExecutor").invoke(null);
} catch (NoSuchMethodException x) {
return Executors.newCachedThreadPool(/* as before */);
} catch (Exception x) {
throw new AssertionError(x);
} which should probably be made into an API in Jenkins core. |
Just filed the downstream PR: jenkinsci/opentelemetry-plugin#1139 |
My (limited) understanding of the current state with virtual threads was that unless you are running homogenous tasks that you know do not use |
FTR @jgreffe if you want to update the PR description here is some extra context:
In order for this to work, plugins need access to an OTel
There may be other ways to accomplish the same use case, but we have not explored them at this time:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment with some context after thinking about possible alternative approaches. I also added some comments upstream about the fact that the new extension point wouldn't work for dynamic plugin installations, but IDK how important that is.
src/main/java/org/jenkinsci/plugins/workflow/steps/SynchronousNonBlockingStepExecution.java
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/workflow/steps/SynchronousNonBlockingStepExecution.java
Outdated
Show resolved
Hide resolved
Sure, it depends on what the thread is doing. Anyway that is irrelevant to the apparent purpose of this API based on the downstream PR. |
@jglick : then should I apply your suggestion? #226 (comment) |
Looking into a similar case in jenkinsci/opentelemetry-plugin#1137, I also thought about instead adding a dependency on I am a little more hesitant about adding dependencies to this plugin than to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
SynchronousNonBlockingStepExecutorServiceAugmentor
SynchronousNonBlockingStepExecution.ExecutorServiceAugmentor
extension point
I would rather avoid that. |
Allow the
executorService
to be augmented.This avoids having to use reflection by dependent plugins.
Updated with comment from @dwnusbaum
Testing done
Submitter checklist